<!-- 评分结果管理 -->
<template>
  <div class="box">

    <div class="topBar">
      <div class="topBox">
        <el-form :inline="true" :model="bondInfoForm">
          <el-form-item label="评价方案名称：">
            <el-input v-model="bondInfoForm.bondSname" clearable></el-input>
          </el-form-item>
          <el-form-item label="方案截止日期：">
            <el-date-picker v-model="bondInfoForm.value1" type="daterange" range-separator="至" start-placeholder="开始日期"
              end-placeholder="结束日期">
            </el-date-picker>
          </el-form-item>
          <el-form-item label="指标体系：">
            <el-select v-model="value" placeholder="请选择">
              <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
              </el-option>
            </el-select>
            <!-- <el-input v-model="bondInfoForm.bondId" clearable></el-input> -->
          </el-form-item>
          <el-form-item style="float: right">
            <el-button type="primary" @click="bondInfoSubmit" class="btn">查询</el-button>
            <el-button type="primary" @click="bondInfoSubmit" class="btn">重置</el-button>
          </el-form-item>
        </el-form>
        <!-- <div class="zj">
          <span class="zjTitle">债券信息</span>
          <span class="zjInput" @click="zjFn">{{ bondInfo.bondFname }}</span>
        </div>
        <div class="searchBtn">
          <el-button type="primary" class="btn" @click="clearFn">重置</el-button>
        </div> -->
      </div>
    </div>
    <div class="right">
      <!-- 表格 -->


      <div class="tableBox">
        <div class="tableBoxChild">
          <div style="margin-bottom: 20px;">

            <el-button type="primary" @click="bondInfoSubmit" class="btn">导入手工评分台账</el-button>
          </div>
          <el-table :data="tableData" @selection-change="handleSelectionChange">
            <el-table-column type="selection" width="55">
            </el-table-column>
            <!-- <el-table-column label="序号" align="center" type="index">
            </el-table-column> -->
            <el-table-column prop="prop" label="评价方案" align="center">
            </el-table-column>
            <el-table-column prop="prop1" label="评价周期" align="center">
            </el-table-column>
            <!-- <el-table-column prop="name" label="来访时间" align="center">
            </el-table-column> -->
            <el-table-column label="开始日期" align="center" prop="prop2">
            </el-table-column>
            <el-table-column prop="prop3" label="结束日期" align="center">
            </el-table-column>
            <el-table-column prop="prop4" label="指标体系" align="center">
            </el-table-column>
            <el-table-column prop="prop5" label="创建机构" align="center">
            </el-table-column>
          </el-table>
        </div>
        <el-pagination background layout="prev, pager, next" :total="total" @current-change="pageFn">
        </el-pagination>
      </div>
    </div>



    <div class="bottom">
      <!-- 表格 -->

      <div class="bondCard">
        <div class="lef">查看评分结果</div>
        <div class="r">评分时间：2022-21-21</div>
      </div>
      <div class="tableBox">
        <el-table :data="tableData1">
          <!-- <el-table-column label="排名" align="center" type="index">
                  </el-table-column> -->
          <el-table-column prop="prop" label="排名" align="center">
          </el-table-column>
          <el-table-column prop="prop1" label="客户名称" align="center">
          </el-table-column>
          <!-- <el-table-column prop="name" label="同类型名称" align="center">
          </el-table-column> -->
          <el-table-column prop="prop2" label="客户类型" align="center">
          </el-table-column>

          <!-- <el-table-column label="name" align="center" :formatter="glFn">
          </el-table-column> -->
          <el-table-column prop="prop3" label="总计分值" align="center">
          </el-table-column>
          <el-table-column prop="prop4" label="指标一" align="center">
          </el-table-column>
          <el-table-column prop="prop5" label="分值" align="center">
          </el-table-column>
          <el-table-column prop="prop6" label="指标二" align="center">
          </el-table-column>
          <el-table-column prop="prop7" label="分值" align="center">
          </el-table-column>
          <el-table-column prop="prop8" label="指标三" align="center">
          </el-table-column>
          <el-table-column prop="prop9" label="分值" align="center">
          </el-table-column>
          <!-- <el-table-column prop="name" label="完成值" align="center">
          </el-table-column> -->

        </el-table>
        <el-pagination background layout="prev, pager, next" :total="total" @current-change="pageFn">
        </el-pagination>
      </div>
    </div>
  </div>
</template>
<script>
import { getBond } from "@/api/common/index.js";
import {
  queryBondProbabilityDetail,
  newBondInfo,
} from "@/api/recommendationSystem/index.js";
export default {
  data() {
    return {
      tableData: [
        {
          prop: '2023年客户贡献度01',
          prop1: '年',
          prop2: '2023-01-01',
          prop3: '2023-01-01',
          prop4: '客户',
          prop5: '数据中心',
        },
        {
          prop: '2023年客户贡献度02',
          prop1: '年',
          prop2: '2023-01-01',
          prop3: '2023-01-01',
          prop4: '客户',
          prop5: '数据中心',
        },
        {
          prop: '2023年客户贡献度03',
          prop1: '年',
          prop2: '2023-01-01',
          prop3: '2023-01-01',
          prop4: '客户',
          prop5: '数据中心',
        },
        {
          prop: '2023年客户贡献度04',
          prop1: '年',
          prop2: '2023-01-01',
          prop3: '2023-01-01',
          prop4: '客户',
          prop5: '数据中心',
        },
      ],
      tableData1:[
        {
          prop:'1',
          prop1:'中国工商银行股份有限公司',
          prop2:'国有银行',
          prop3:'98',
          prop4:'交易规模',
          prop5:'100',
          prop6:'交易频率',
          prop7:'100',
          prop8:'交易品种',
          prop9:'100',
        },
        {
          prop:'2',
          prop1:'中国建设银行股份有限公司',
          prop2:'国有银行',
          prop3:'97',
          prop4:'交易规模',
          prop5:'90',
          prop6:'交易频率',
          prop7:'90',
          prop8:'交易品种',
          prop9:'90',
        },
        {
          prop:'3',
          prop1:'天弘基金管理有限公司',
          prop2:'基金公司',
          prop3:'90',
          prop4:'交易规模',
          prop5:'90',
          prop6:'交易频率',
          prop7:'90',
          prop8:'交易品种',
          prop9:'90',
        },
        {
          prop:'4',
          prop1:'宁波银行股份有限公司',
          prop2:'股份制银行',
          prop3:'89',
          prop4:'交易规模',
          prop5:'70',
          prop6:'交易频率',
          prop7:'70',
          prop8:'交易品种',
          prop9:'70',
        }
      ],
      options: [{
        value: '选项1',
        label: '2021年考核系'
      }, {
        value: '选项2',
        label: '2021年考核系'
      }, {
        value: '选项3',
        label: '2021年考核系'
      }, {
        value: '选项4',
        label: '2021年考核系'
      }, {
        value: '选项5',
        label: '2021年考核系'
      }],
      value: '',
      //  tabs切换
      activeName: "second",
      drawer: false,
      searchList: [],
      // tableData: [],
      searchInput: "",
      bondInfo: {},
      total: 0,
      count: "",
      page: 1,
      bondTotal: 0,
      bondInfoForm: {
        bondSname: "",
        bondId: "",
        value1: "",
      },
    };
  },
  filters: {
    filterNum(value) {
      const str = value ? value.toString() : "";
      if (str) {
        const reg =
          str.indexOf(".") > -1 ? /\B(?=(\d{3})+\.)/g : /\B(?=(\d{3})+$)/g;
        const returnData = str.replace(reg, ",");
        return returnData;
      } else {
        return "";
      }
    },
  },
  mounted() { },
  methods: {

    //表格全选
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
    //
    clearFn() {
      this.bondInfo = {};
    },
    bondInfoSubmit() {
      const param = {
        ...this.bondInfoForm,
        pn: 10,
        page: 1,
      };
      console.log("newBondInfo param", param);
      this.newBondInfo(param);
    },
    glFn(row) {
      return row.assessRate;
      // return Number(Number(row.assessRate) * 100).toFixed(2) + "%"
    },
    zjFn() {
      this.drawer = true;
      const param = {
        bondName: "",
        bondId: "",
        pn: 10,
        page: 1,
      };
      this.newBondInfo(param);
    },
    bondRowClick(row) {
      this.drawer = false;
      const param = {
        bondName: row.bondName,
        bondId: row.bondId,
        pn: 10,
        page: 1,
      };
      getBond(param).then((res) => {
        this.bondInfo = res.data.result[0];
      });
      queryBondProbabilityDetail({
        bondId: row.bondId,
        page: 1,
        pn: 10,
      }).then((res) => {
        console.log(res, "resres");
        this.tableData = res.data.result;
        this.total = Number(res.data.totalResults);
      });
    },
    bondPageFn(page) {
      const param = {
        bondName: "",
        bondId: "",
        pn: 10,
        page: page,
      };
      this.newBondInfo(param);
    },
    pageFn(currentPage) {
      console.log("pageFn", currentPage);
      queryBondProbabilityDetail({
        bondId: this.bondInfo.bondId,
        page: currentPage,
        pn: 10,
      }).then((res) => {
        this.tableData = res.data.result;
        this.total = Number(res.data.totalResults);
      });
    },
    newBondInfo(param) {
      const _this = this;
      newBondInfo(param).then((res) => {
        _this.searchList = res.data.result;
        _this.bondTotal = Number(res.data.totalResults);
        console.log(res, "resres");
      });
    },
    clickFn(v, i) {
      this.clearFn();
      this.count = i;
      this.bondInfo = {
        ...v,
      };
      queryBondProbabilityDetail({
        bondId: v.bondId,
        page: this.page,
        pn: 10,
      }).then((res) => {
        console.log(res, "resres");
        this.tableData = res.data.result;
        this.total = Number(res.data.totalResults);
      });
    },
  },
};
</script>
<style lang="scss" scoped>
.el-table ::v-deep th.el-table__cell {
  background-color: #1c2238 !important;
  color: #fff;
}

.pop .el-form ::v-deep .el-form-item .el-form-item__content .el-input__inner {
  width: 100%;
}

.pop .el-form ::v-deep .el-form-item .el-form-item__content .el-textarea__inner {
  border: 1px solid rgba(126, 163, 255, 0.3);
  color: #ffffff;
  background-color: #363657;
}

.pop ::v-deep .el-button--primary {
  border: 1px solid rgba(126, 163, 255, 0.3);
  color: #ffffff;
  background-color: #363657;
}

::v-deep .el-pagination.is-background .el-pager li:not(.disabled).active {
  background-color: #363657;
  background: rgba(31, 155, 253, 0.2);
  color: #fff;
}

::v-deep .el-pagination.is-background .btn-next,
.el-pagination.is-background .el-pager li {
  background-color: #363657;
}

::v-deep .el-pagination.is-background .btn-prev,
.el-pagination.is-background .el-pager li {
  background-color: #363657;
}

.box {
  .topBar {
    box-sizing: border-box;
    padding-top: 10px;
    min-height: 40px;
    background-color: #262d47;
    margin-bottom: 10px;
    padding-left: 10px;

  }

  .topBox {
    display: flex;
  }

  .left {
    width: 240px;
    background-color: #262d47;
    height: 100%;
  }

  .bottom {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
  }

  .searchList {
    padding-top: 10px;
    height: 700px;
    overflow: scroll;
    padding-left: 10px;

    .searchListItem {
      height: 35px;
      line-height: 35px;
      text-align: center;
      color: #959fc5;
      font-size: 12px;
      overflow: hidden; //超出隐藏
      white-space: nowrap; //不折行
      text-overflow: ellipsis; //溢出显示省略号
    }

    .searchListItem:hover {
      background: #1f9bfd !important;
      color: #fff;
      cursor: pointer;
    }
  }

  .searchListItemAct {
    background: #1f9bfd !important;
    color: #fff !important;
  }

  .bondCard {
    display: flex;
    box-sizing: border-box;
    margin-top: 10px;
    background-color: #262d47;
    color: #ffffff;
    margin-bottom: 10px;
    height: 50px;
    line-height: 50px;
    padding-left: 10px;
    padding-right: 10px;
    justify-content: space-between;

    .lef {
      font-size: 20px;

    }

    .info {
      display: flex;
      padding: 20px 20px;
    }

    .infoItem {
      width: 300px;
    }

    .infoItemVal {
      font-size: 14px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #d6dcff;
    }

    .infoItemLabel {
      margin-right: 30px;
      font-size: 14px;
    }
  }
.mine

  .el-table ::v-deep th.el-table__cell {
    background-color: #1c2238 !important;
    color: #fff;
  }

  .tableBox {
    background-color: #262d47;
    flex: 1;
    padding: 15px 10px;
  }

  .tableBoxChild {
    min-height: 400px;
  }

  .el-pagination {
    text-align: right;
  }

  .leftTitle {
    height: 40px;
    line-height: 40px;
    background: #354060;
    font-size: 14px;
    font-family: PingFang-SC-Bold, PingFang-SC;
    font-weight: bold;
    color: #ffffff;
    padding-left: 17px;
    margin-bottom: 10px;
  }

  .bondCardTitle {
    height: 40px;
    background: #354060;
    font-size: 14px;
    font-family: PingFang-SC-Bold, PingFang-SC;
    font-weight: bold;
    color: #ffffff;
    padding: 10px 16px;
  }
}
</style>
